package com.atguigu.srb.core.controller;

import com.atguigu.common.result.R;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;

@Api(tags = "控制台登录管理")
@RestController
@RequestMapping("/admin/core/adminUser")
@Slf4j
public class LoginController {


    /**
     * 登录
     * @return
     */
    @PostMapping("/login")
    public R login(
            @RequestBody HashMap<String, String> hashMap){
        String username = hashMap.get("username");
        log.info(username + " 登录成功");
        return R.ok().data("token", "admin");
    }

    /**
     * 信息
     * @return
     */
    @GetMapping("/info")
    public R info(){
        return R.ok().data("roles", "[admin]")
                .data("name", "admin")
//                .data("password", "admin");
                .data("avatar", "https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif");
    }



}
